<?php
/**
 * Created by dutuwang.net
 * User: adophper <hello@adophper.com>
 * Date: 2018/4/8
 * Time: 10:58
 */
use yii\helpers\Html;
$this->title = Yii::t('frontend', 'my_follow');
?>
<?=Html::cssFile('/static/frontend/css/center.css')?>
<?=Html::jsFile('/static/frontend/js/swipe.js')?>
<div class="contBox">
    <div class="center_box row">
        <?=$this->render('left')?>
        <div class="col-md-10 right_min">
            <div class="right_box">
                <div class="his_title flex f_between"><label class="t_red">展会关注</label></div>
                <div class="his_list_box">
                    <ul class="follow_list">
                        <?php
                        if (!empty($data['data'])) {
                            foreach ($data['data'] as $val) {
                        ?>
                        <li class="fbox">
                            <div class="follow_icon f_relative fl img">
                                <a href="<?=Yii::$app->urlManager->createUrl(['zhanhui/detail', 'id'=>$val['id']])?>"><img src="<?=$val['litpic']?>_250x150.jpg" alt="<?=$val['title']?>" /></a>
                                <span class="flex f_between">
                                    <label><input type="checkbox"/><em>加入对比</em></label>
                                </span>
                            </div>
                            <div class="follow_item_min fr">
                                <div class="follow_item_title flex f_between">
                                    <p class="t_o"><a href="<?=Yii::$app->urlManager->createUrl(['zhanhui/detail', 'id'=>$val['id']])?>"><?=$val['title']?></a></p>
                                    <div class="flex f_between">
                                        <div class=" rating-stars" title="<?=$val['score']?>">
                                            <span class="empty-stars">
                                                <span class="star"><i class="glyphicon glyphicon-star"></i></span>
                                                <span class="star"><i class="glyphicon glyphicon-star"></i></span>
                                                <span class="star"><i class="glyphicon glyphicon-star"></i></span>
                                                <span class="star"><i class="glyphicon glyphicon-star"></i></span>
                                                <span class="star"><i class="glyphicon glyphicon-star"></i></span>
                                            </span>
                                            <span class="filled-stars" style="width: <?=$val['score']*20?>%;">
                                                <span class="star"><i class="glyphicon glyphicon-star"></i></span>
                                                <span class="star"><i class="glyphicon glyphicon-star"></i></span>
                                                <span class="star"><i class="glyphicon glyphicon-star"></i></span>
                                                <span class="star"><i class="glyphicon glyphicon-star"></i></span>
                                                <span class="star"><i class="glyphicon glyphicon-star"></i></span>
                                            </span>
                                        </div>
                                        <span class="follow_btn" data-id="<?=$val['id']?>"><i class="iconfont">&#xe624;</i><em>取消关注</em></span>
                                    </div>
                                </div>
                                <p class="follow_item_txt">展会时间：<?=$val['show_start']?> 至 <?=$val['show_end']?></p>
                                <p class="follow_item_txt">展馆地点：<?=$val['city']?></p>
                                <p class="follow_item_txt">主办方：20160329 至 20160501</p>
                                <div class="follow_item_foot flex f_between">
                                    <div class="flex">
                                        <span><label>展馆面积：</label><em class="t_yel"><?=$val['area']?></em></span>
                                        <span><label>参展商：</label><em class="t_yel"><?=$val['business_number']?></em></span>
                                        <span><label>观众量：</label><em class="t_yel"><?=$val['audience_number']?></em></span>
                                    </div>
<!--                                    <span class="btn_yel">立即咨询</span>-->
                                </div>
                            </div>
                        </li>
                        <?php
                            }
                        }
                        ?>
                    </ul>
                    <div class="f_page flex f_end list-page">
                        <?php
                        if (!empty($data['data'])) {
                            echo \yii\widgets\LinkPager::widget([
                                'pagination' => $data['page'],
                            ]);
                        }
                        ?>
                    </div>
                </div>
            </div>
            <div class="white_box left_min">
                <div class="his_title flex f_between"><label>展会推荐</label><a href="<?=Yii::$app->urlManager->createUrl(['zhanhui/index'])?>">更多&gt;</a></div>
                <div class="his_list_box">
                    <div class="history_list">
                        <div class="history-nav swipe-nav swipe-nav-left">
                            <div class="swipe-nav-bar history-prev"><i class="iconfont">&#xe65d;</i></div>
                        </div>
                        <div class="swipe" id="slider2">
                            <div class="swipe-wrap">
                                <div class="left_min_list pull-left">
                                    <div class="clearfix">
                                        <?php
                                        if (!empty($recommend)) {
                                        $i = 1;
                                        $recommendCount = count($recommend);
                                        foreach ($recommend as $val) {
                                        ?>
                                        <div class="pull-left min_list_item_box" style="width: 33.33%">
                                            <div class="f_relative">
                                                <a href="<?=Yii::$app->urlManager->createUrl(['zhanhui/detail', 'id'=>$val['id']])?>"><img src="<?=$val['litpic']?>_184x150.jpg" alt="<?=$val['title']?>" /></a>
                                                <p class="t_o"><a href="<?=Yii::$app->urlManager->createUrl(['zhanhui/detail', 'id'=>$val['id']])?>"><?=$val['title']?></a></p>
                                            </div>
                                            <p class="flex t_o"><i class="t_red iconfont">&#xe615;</i><?=$val['show_start']?> 至 <?=$val['show_end']?></p>
                                            <p class="flex"><i class="t_red iconfont">&#xe620;</i><?=$val['city']?></p>
                                        </div>
                                        <?php
                                        if ($i % 3 == 0 && $i < $recommendCount) {
                                        ?>
                                    </div></div><div class="left_min_list pull-left"><div class="clearfix">
                                        <?php
                                        }
                                        $i++;
                                        }
                                        }
                                        ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="history-nav swipe-nav swipe-nav-right">
                            <div class="swipe-nav-bar history-next"><i class="iconfont">&#xe617;</i></div>
                        </div>
                        <script>
                            var slider2 = Swipe(document.getElementById('slider2'), {
                                auto: 3000,
                                continuous: true,
                                callback: function(pos) {}
                            });
                            $(function(){
                                $(".history-prev").click(function(e){
                                    e.preventDefault();
                                    slider2.prev();
                                });
                                $(".history-next").click(function(e){
                                    e.preventDefault();
                                    slider2.next();
                                });
                            });
                        </script>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
$(function () {
   $(".follow_btn").on('click', function (e) {
       var id = $(this).data('id');
       $.post('<?=Yii::$app->urlManager->createUrl(['zhanhui/go-follow'])?>', {id: id}, function (response) {
           if (response.code == 0) {
               location.reload();
           }else{
               alert(response.msg);
           }
       }, 'json')
   })
})
</script>
